<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Title</title>
</head>
<body>
<form action="cookie.php" method="post">
	<input id="abc" type="text" name="username">
	<input type="submit" value="登录">
</form>
<script>
	window.onload = function () {
		var cookiename = document.cookie;
		if(cookiename){

			var a=cookiename.split("=")[1];
			var abc = document.getElementById("abc");
		    if(cookiename.split("=")[0]==="username"){
			    console.log(cookiename);
		    }

		}
	}
</script>
</body>
</html>